
//
//  ClassroomTableViewCell.swift
//  SchoolDemo
//
//  Created by rimi on 16/10/13.
//  Copyright © 2016年 YQ. All rights reserved.
//

import UIKit

class ClassroomTableViewCell: UITableViewCell {

    //时间
    var classtimeL = UILabel()
    //老师名
    var classteacherL = UILabel()
    //头像
    var classIconView = UIImageView()
    //科目
    var classroomBtn = UIButton()
    //习题测试
    var claccroomTitleL = UILabel()
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
 
    
    func setupUI() {
        //头像
        addSubview(classIconView)
        classIconView.snp.makeConstraints { (make) in
            make.top.equalTo(16)
            make.left.equalTo(16)
            make.width.equalTo(65)
            make.height.equalTo(65)
            
        }
        
        //习题测试
        claccroomTitleL.textColor = UIColor().colorWithHex(0x4c4c4c)
        claccroomTitleL.font = UIFont.systemFont(ofSize: 16)
        addSubview(claccroomTitleL)
        claccroomTitleL.snp.makeConstraints { (make) in
            make.top.equalTo(classIconView.snp.top)
            make.left.equalTo(classIconView.snp.right).offset(15)
            make.width.equalTo(100)
            make.height.equalTo(30)
            
            
        }
        //科目
        classroomBtn.layer.cornerRadius = 8
        classroomBtn.setTitleColor(UIColor().colorWithHex(0x009ee7), for: .normal)
        classroomBtn.layer.borderWidth = 1
        classroomBtn.layer.borderColor = UIColor().colorWithHex(0x009ee7).cgColor
        addSubview(classroomBtn)
        
        classroomBtn.isUserInteractionEnabled = false
        
        classroomBtn.snp.makeConstraints { (make) in
            make.top.equalTo(claccroomTitleL.snp.bottom).offset(8)
            make.left.equalTo(claccroomTitleL.snp.left)
            make.width.equalTo(80)
            make.height.equalTo(23)
        }
        
        //老师名字
        classteacherL.textColor = UIColor().colorWithHex(0x4c4c4c)
        classteacherL.font = UIFont.systemFont(ofSize: 15)
        classteacherL.textAlignment = .right
        addSubview(classteacherL)
        
        classteacherL.snp.makeConstraints { (make) in
            make.top.equalTo(classIconView.snp.top)
            make.left.equalTo(claccroomTitleL.snp.right).offset(80)
            make.height.equalTo(23)
            make.width.equalTo(80)
            
        }
        //时间
        classtimeL.textColor = UIColor().colorWithHex(0xcccccc)
        classtimeL.textAlignment = .center
        classtimeL.font = UIFont.systemFont(ofSize: 15)
        addSubview(classtimeL)
        
        classtimeL.snp.makeConstraints { (make) in
            make.right.equalTo(classteacherL.snp.right)
            make.top.equalTo(classteacherL.snp.bottom).offset(16)
            make.bottom.equalTo(classroomBtn.snp.bottom)
        }
    }
    
    
    
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
